package com.portal.portal.config;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class DriverPageConfig {
  private String name;
  private String uri;
  private Collection portletIds;
  private int orderNumber;

  public DriverPageConfig() {
    this.portletIds = new ArrayList();
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getUri() {
    return uri;
  }

  public void setUri(String uri) {
    this.uri = uri;
  }

  public Collection getPortletIds() {
    return portletIds;
  }

  public void setPortletIds(Collection ids) {
    this.portletIds = ids;
  }

  public void addPortlet(String contextPath, String portletName) {
    /*synchronized (portletIds) {
      portletIds.add(PortletWindowConfig.createPortletId(contextPath, portletName, createPlacementId()));
    }*/
  }

  public void removePortlet(String portletId) {
    portletIds.remove(portletId);
  }

  void setOrderNumber(int number) {
    this.orderNumber = number;
  }

  int getOrderNumber() {
    return orderNumber;
  }

  private String createPlacementId() {
    return getName().hashCode() + "|" + portletIds.size();
  }
}
